﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using DongleManage.Model.BaseClass;
using System.Data;

namespace DongleManage.Model.EssentialData
{


    /// <summary>
    ///  表'ActionInfo'的实体表示.
    ///  动作信息表
    /// </summary>
    /// <remarks>
    /// 该实体由工具生成，尽量不要手动修改
    /// </remarks>
    [DataContract]
    public partial class ActionInfoEntity : BaseEntity
    {
        #region 属性、变量声明
        #region 主属性 --对应数据表主键
        /// <summary>			
        /// 动作编码 
        /// </summary>
        /// <remarks>表ActionInfo主键</remarks>
        [DisplayName("动作编码")]
        [DataMember]
        public Int32 Code
        {
            get;
            set;
        }
        #endregion

        #region 属性

        /// <summary>
        /// 动作名称
        /// </summary>
        [DisplayName("动作名称")]
        [Required(ErrorMessage = "不允许为空!")]
        [StringLength(128, ErrorMessage = "请勿输入超过 128 个字!")]

        [DataMember]
        public String Name
        {
            get;
            set;
        }

        /// <summary>
        /// 重量是否输入 : 1:输入 0:不输入
        /// </summary>
        [DisplayName("重量是否输入")]
        [Required(ErrorMessage = "1:输入 0:不输入不允许为空!")]

        [DataMember]
        public Int32 Weight
        {
            get;
            set;
        }

        /// <summary>
        /// 计量单位代码 :
        /// </summary>
        [DisplayName("计量单位代码")]

        [DataMember]
        public Int32? UnitCode
        {
            get;
            set;
        }

        /// <summary>
        /// 计量单位名称 
        /// </summary>
        [DisplayName("计量单位名称")]
        [StringLength(64, ErrorMessage = "请勿输入超过 64 个字!")]

        [DataMember]
        public String UnitName
        {
            get;
            set;
        }

        /// <summary>
        /// 计量单位英文名称
        /// </summary>
        [DisplayName("计量单位英文名称")]
        [StringLength(64, ErrorMessage = "请勿输入超过 64 个字!")]

        [DataMember]
        public String UnitEName
        {
            get;
            set;
        }

        /// <summary>
        /// 组数是否输入 
        /// </summary>
        [DisplayName("组数是否输入")]
        [Required(ErrorMessage = "1:输入 0:不输入不允许为空!")]

        [DataMember]
        public Int32 NumberOfgroups
        {
            get;
            set;
        }

        /// <summary>
        /// 每组次数是否输入 
        /// </summary>
        [DisplayName("每组次数是否输入")]
        [Required(ErrorMessage = "1:输入 0:不输入不允许为空!")]

        [DataMember]
        public Int32 CountPerGroup
        {
            get;
            set;
        }

        /// <summary>
        /// 间歇时间 是否输入 单位为分钟
        /// </summary>
        [DisplayName("间歇时间 是否输入")]
        [Required(ErrorMessage = "1:输入 0:不输入不允许为空!")]

        [DataMember]
        public Int32 RestTime
        {
            get;
            set;
        }

        /// <summary>
        /// 强度是否输入
        /// </summary>
        [DisplayName("强度是否输入1:输入 0:不输入")]
        [Required(ErrorMessage = "1:输入 0:不输入不允许为空!")]

        [DataMember]
        public Int32 Strength
        {
            get;
            set;
        }

        /// <summary>
        /// 审核标志: 0未审核，1审核通过 
        /// </summary>
        [DisplayName("审核标志")]
        [Required(ErrorMessage = "不允许为空!")]

        [DataMember]
        public Int32 Flag
        {
            get;
            set;
        }

        /// <summary>
        /// 备注
        /// </summary>
        [DisplayName("备注")]
        [StringLength(256, ErrorMessage = "请勿输入超过 256 个字!")]

        [DataMember]
        public String Memo
        {
            get;
            set;
        }

        /// <summary>
        /// 图片路径
        /// </summary>
        [DataMember]
        public string ImagePath { get; set; }

        #endregion

        #endregion 属性、变量声明

        public ActionInfoEntity()
        {
            Code = (int)0;
            Name = string.Empty;
            Weight = (int)0;
            UnitCode = null;
            UnitName = null;
            UnitEName = null;
            NumberOfgroups = (int)0;
            CountPerGroup = (int)0;
            RestTime = (int)0;
            Strength = (int)0;
            Flag = (int)0;
            Memo = null;
            InUserID = (int)0;
            InDate = DateTime.Now;
            EditUserID = (int)0;
            EditDate = null;
        }

        public ActionInfoEntity(IDataReader dataReader)
            : base(dataReader)
        {
            Code = Convert.IsDBNull(dataReader["Code"]) ? 0 : Convert.ToInt32(dataReader["Code"]);
            Name = Convert.IsDBNull(dataReader["Name"]) ? "" : Convert.ToString(dataReader["Name"]);
            Weight = Convert.IsDBNull(dataReader["Weight"]) ? 0 : Convert.ToInt32(dataReader["Weight"]);
            UnitCode = Convert.IsDBNull(dataReader["UnitCode"]) ? 0 : Convert.ToInt32(dataReader["UnitCode"]); ;
            UnitName = Convert.IsDBNull(dataReader["UnitName"]) ? "" : Convert.ToString(dataReader["UnitName"]); ;
            UnitEName = Convert.IsDBNull(dataReader["UnitEName"]) ? "" : Convert.ToString(dataReader["UnitEName"]); ;
            NumberOfgroups = Convert.IsDBNull(dataReader["NumberOfgroups"]) ? 0 : Convert.ToInt32(dataReader["NumberOfgroups"]);
            CountPerGroup = Convert.IsDBNull(dataReader["CountPerGroup"]) ? 0 : Convert.ToInt32(dataReader["CountPerGroup"]);
            RestTime = Convert.IsDBNull(dataReader["RestTime"]) ? 0 : Convert.ToInt32(dataReader["RestTime"]);
            Strength = Convert.IsDBNull(dataReader["Strength"]) ? 0 : Convert.ToInt32(dataReader["Strength"]);
            Flag = Convert.IsDBNull(dataReader["Flag"]) ? 0 : Convert.ToInt32(dataReader["Flag"]);
            Memo = Convert.IsDBNull(dataReader["Memo"]) ? "" : Convert.ToString(dataReader["Memo"]);
        }
    }
}
